package cn.hhz._05mvcboot01.controller;

import cn.hhz._05mvcboot01.pojo.dto.UserLoginDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {

    @RequestMapping("v1/users/login")
    @ResponseBody
    public String login(HttpServletRequest request){
        String username = request.getParameter("username");
        String password = request.getParameter("password");

        return username + ":" + password;
    }

    @RequestMapping("v1/users/login2")
    @ResponseBody
    public String login2(UserLoginDTO userLoginDTO){
        String username = userLoginDTO.getUsername();
        String password = userLoginDTO.getPassword();

        return username + "-" + password;
    }

    @RequestMapping("v1/users/login3")
    @ResponseBody
    public String login3(String username,String password){

        return username + "+" + password;
    }

    @RequestMapping("v1/users/reg")
    @ResponseBody
    public String reg(){
        return "注册成功";
    }

}
